<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/WEB-INF/adminui/include/css.jsp" %>
<link href="${path}/res/js/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${path}/res/js/ligerUI/skins/Gray2014/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${path}/res/js/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.l-box-select-inner {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: auto;
    height: 120px;
    color: #333;
}   
</style>
<title>添加物品列表</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox">
				<div class="ibox-body">
					<div class="fixed-table-toolbar">
						<div id="toolbar" class="columns pull-left">
						</div>
						<div class="columns pull-right">
							<button class="btn btn-success" onclick="loadTable()">查询</button>
						</div>
						<div class="columns pull-right col-md-2 nopadding" style="width:125px;margin-right:5px;">
							<select id="typeid" class="form-control">
								<option value="">--选择类别--</option>
								<c:forEach items="${types}" var="type">
								<option value="${type.typeid}">${type.typeName}</option>
								</c:forEach>
							</select>
						</div>
						<div class="columns pull-right col-md-2 nopadding">
							<input id="searchName" type="text" class="form-control" placeholder="关键字">
						</div>
					</div>
					<table id="dataTable" data-mobile-responsive="true">
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<%@ include file="/WEB-INF/adminui/include/script.jsp" %>
<script src="${path}/res/js/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	var dialogData = parent.getLayerData();

	var table = $("#dataTable");
	table.bootstrapTable('destroy');
	table.bootstrapTable({
		url: "${path}/res/listResdata.json",
		idfield: 'resid',
		cache: false,	//禁用 AJAX 数据缓存
		striped: true,	//表格显示条纹
		pagination: true,//显示分页组件
		pageList: [10, 20],
		pageSize: 10,
		pageNumber: 1,
		sidePagination: 'server',
		queryParams: function(params){
			var params = {
					page: parseInt(params.offset / params.limit) + 1,
					pagesize: params.limit,
					sortname: params.sort || '',
					sortorder: params.order,
					search: $("#searchName").val(),
					typeid: $("#typeid").val()
		          };
				return params;
			},
		columns: [
			{radio : true, field : 'checked', formatter: function(value, row){ return {checked: (row.resid==dialogData.resid)}; }},
			{field : 'typeName', title : '类别'},
			{field : 'resDm', title : '物品代码'},
			{field : 'resTm', title : '物品条码'},
			{field : 'resName', title : '物品名称'},
			{field : 'pinyin', title : '拼音助记符'},
			{field : 'model', title : '型号'},
			{field : 'unit', title : '单位'},
			{field : 'sccj', title : '生产单位'},
			/* {field : 'stockMax', title : '库存上限'},
			{field : 'stockMin', title : '库存下限'}, */
			{field : 'inPrice', title : '默认入库价格'},
			{field : 'outPrice', title : '默认出库价格'},
			{field : 'middlePrice', title : '库存平均价格'}
		]
	});
});
function loadTable(){
	$("#dataTable").bootstrapTable('refresh');
}
function getSelectedData(){
	var rows = $("#dataTable").bootstrapTable('getSelections');
	if(rows && rows.length){
		return rows[0];
	}
	return null;
}
</script>
</body>
</html>